import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;

import parser.XMIParser;

public class Main {

	public static void main(String[] args) throws Throwable {

		File file = new File("resources" + File.separator + "input.txt");
		File uml = new File("resources" + File.separator + "uml.xml");
		if (!file.exists()) {
			System.err.println("[ERROR] resources/input.txt or resources/uml.xml may not exist.");
			System.exit(-1);
		}

		Lexer scanner = new Lexer(new FileReader(file));

		XMIParser xmiParser = new XMIParser();
		xmiParser.parse(new FileInputStream(uml));

		parser parser = new parser(scanner);
		parser.parse();
		
		System.out.println("[INFO] Lexic, syntax and semantic analysis OK!");
		System.exit(0);
	}

}